<template>
  <div class="test-container">
    <!-- <LoadingButton @click="handleClick" /> -->
    <!-- props传递函数形式 -->
    <LoadingButton :click="handleClick" />
  </div>
</template>

<script>
import LoadingButton from "./components/LoadingButton.vue";
export default {
  name: "Test",
  components: { LoadingButton },
  data() {
    return {};
  },
  methods: {
    // $emit回调形式
    /* async handleClick(callback) {
      setTimeout(() => {
        callback("abcd");
      }, 3000);
    }, */
    // $listeners方式
    async handleClick(count) {
      console.log("🚀 ~ handleClick ~ count:", count);
      return new Promise((resolve) => {
        setTimeout(() => {
          resolve("有一个未知错误");
        }, 3000);
      });
    },
  },
};
</script>

<style scoped lang="less"></style>
